package org.example.composite;

import java.util.ArrayList;
import java.util.List;

/**
 * @author wangbin
 * @date 2024/4/18
 * @vesion 1.0
 */
public class University extends OrganizationComponent{
    List<OrganizationComponent> organizationComponentList =new ArrayList<>();

    public University(String name, String dec) {
        super(name, dec);
    }

    @Override
    protected void add(OrganizationComponent organizationComponent) {
        organizationComponentList.add(organizationComponent);
    }

    @Override
    protected void remove(OrganizationComponent organizationComponent) {
        organizationComponentList.remove(organizationComponent);
    }

    @Override
    public String getName() {
        return super.getName();
    }

    @Override
    public String getDec() {
        return super.getDec();
    }

    @Override
    protected void print() {
        for (OrganizationComponent organizationComponent : organizationComponentList) {
            organizationComponent.print();
        }

    }
}
